from operation.db_operation import strategy_Operation
from utils.data_proccess import *

#新建策略
def add_strategy(kwargs):
    s_o = strategy_Operation()
    result = s_o.add_strategy(kwargs)
    return result

#删除策略
def del_strategy(kwargs):
    s_o = strategy_Operation()
    result = s_o.del_strategy(kwargs)
    return result

#查询策略列表
def get_strategy(kwargs):
    s_o = strategy_Operation()
    result_data = s_o.get_strategy(kwargs)
    result  =  Class_To_Data(result_data,s_o.__fields__)
    return result

#修改策略代码
def update_code(kwargs):
    s_o = strategy_Operation()
    result = s_o.update_code(kwargs)
    return result

#修改策略名
def update_straName(kwargs):
    s_o = strategy_Operation()
    result = s_o.update_straName(kwargs)
    return result

#修改运行次数
def update_runtime(kwargs):
    s_o = strategy_Operation()
    result = s_o.update_runtime(kwargs)
    return result

#修改回测次数
def update_rollbacktime(kwargs):
    s_o = strategy_Operation()
    result = s_o.update_rollbacktime(kwargs)
    return result